<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.w3.org/1999/xhtml">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>SUOYUEの用户登录</title>

  <link rel="shortcut icon" th:href="@{/images/favicon.ico}" />
  <link rel="stylesheet" href="../static/lib/Semantic-UI/semantic.min.css" th:href="@{/lib/Semantic-UI/semantic.min.css}">
  <link rel="stylesheet" href="../static/css/me.css" th:href="@{/css/me.css}">
</head>
<body>

<br>
<br>
<br>
 <div class="m-container-small m-padded-tb-massive" style="max-width: 30em !important;">
   <div class="ur container">
     <div class="ui middle aligned center aligned grid">
       <div class="column">
         <h2 class="ui teal image header">
           <div class="content">
             欢 迎 登 录
           </div>
         </h2>
         <form class="ui large form" method="post" action="/login" th:action="@{/login}">
           <div class="ui  segment">
             <div class="field">
               <div class="ui left icon input">
                 <i class="user icon"></i>
                 <input type="text" name="username" placeholder="邮 箱">
               </div>
             </div>
             <div class="field">
               <div class="ui left icon input">
                 <i class="lock icon"></i>
                 <input type="password" name="password" placeholder="密 码">
               </div>
             </div>
             <div class="field">
               <div class="ui labeled left icon input">
                 <i class="bullhorn icon"></i>
                 <input name="captcha" placeholder="验 证 码" type="text">
                 <img src="/captcha" onclick="this.src=this.src+'?'+Math.random()" title="点击刷新"/>
               </div>
             </div>
             <button class="ui fluid large teal submit button">登   录</button>
           </div>

           <div class="ui error mini message"></div>
           <div class="ui mini negative message" th:unless="${#strings.isEmpty(message)}" th:text="${message}">邮箱或密码有误</div>

         </form>
         <div class="ui message">
           新用户 ？ <a href="/register">注 册</a>
           <a class="m-padded-l" href="/loginByCode">忘记密码 ？</a>
         </div>

       </div>
     </div>
   </div>
 </div>


<!--通用script：使用div标签或thymeleaf模板的th:block-->
<script src="../static/js/jquery.min.js" th:src="@{/js/jquery.min.js}"></script>
<script src="../static/lib/Semantic-UI/semantic.min.js" th:src="@{/lib/Semantic-UI/semantic.min.js}"></script>

<script>
  $('.ui.form').form({
    fields : {
      username : {
        identifier: 'username',
        rules: [{
          type : 'email',
          prompt: '请输入有效的邮箱'
        }]
      },
      password : {
        identifier: 'password',
        rules: [{
          type : 'empty',
          prompt: '请输入密码'
        }]
      },
      captcha : {
        identifier: 'captcha',
        rules: [{
          type : 'empty',
          prompt: '请输入验证码'
        }]
      }
    }
  });
</script>

</body>
</html>